<meta charset="utf-8">
 

<?php
session_start();
$username=$_SESSION['username'];
require_once("mysql.php"); 
/*$con = mysql_connect("localhost","root","1");
if (!$con)
{
    die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);*/
$sql1 = "select * from work where username='$username'";
$result=mysql_query($sql1);
$clumn= mysql_fetch_array($result);
$password=$_POST['password']; 
$name=$_POST['name1']; 
$sex=$_POST['sex']; 
$xueyuan=$_POST['school']; 
$school=$_POST['name']; 
$zhuanye=$_POST['zhuanye'];  
$phone=$_POST['phone'];  
$email=$_POST['email'];
if ($_POST['password']=="") 
{
    $password=$clumn['password'];
}
if ($_POST['name1']=="") 
{
    $name=$clumn['name'];
}
if ($_POST['sex']=="") 
{
    $sex=$clumn['sex'];
}
if ($_POST['school']=="") 
{
    $school=$clumn['school'];
}
if ($_POST['xueyuan']=="") 
{
    $xueyuan=$clumn['xueyuan'];
}
if ($_POST['zhuanye']=="") 
{
    $zhuanye=$clumn['zhuanye'];
}
if ($_POST['phone']=="") 
{
    $phone=$clumn['phone'];
}
if ($_POST['email']=="") 
{
    $email=$clumn['email'];
}
$sql="Update work SET password='$password',name='$name',sex='$sex',school='$school',xueyuan='$xueyuan',zhuanye='$zhuanye',phone='$phone',email='$email' WHERE username = '$username'";
$resul=mysql_query($sql); 
if(!$resul) 
{  
    echo"<script type='text/javascript'>alert('修改失败');location='person_m.php';</script>";  
} 
else   
{  
    echo"<script type='text/javascript'>alert('修改成功');location='login.php';</script>";  
}  
?>